The signal is associated with a certain process. In other words, a process can determine which signals are handled in the process. For example, a process can ignore some signals and handle only some other signals, and a process can also choose how
The simplest interface to the signal characteristics of a UNIX system is the signal function:
#include
void (*signal(int signo, void(* func)(int)))(int);
returns : previous disposition of signal ( see following Span class= "pun"
http://blog.csdn.net/ta893115871/article/details/7475095Signal () function describes Linux functions in detailSignal () function understandingIn the header file.Signal (parameter 1, parameter 2);Parameter 1: The signal we are going to process. The
The second parameter of the signal installation function sigaction (int signum, const struct sigaction * Act, struct sigaction * oldact) is a pointer to the sigaction structure (the struct name is the same as the function name, do not confuse it ).
signal function and Sigaction structure understanding
One, signal function
Detailed Description: http://blog.csdn.net/ta893115871/article/details/7475095
#include
#include
#include
/*
Sig_ign Ignore/SIG_DFL default, both macros can also be
Linux Programming the signal () function when the server close a connection, if the client side then sends the data. According to the provisions of the TCP protocol, you will receive a RST response, when the client sends data to this server, the
Directory
1. Sigaction function detailed 1.1 structure body siginfo_t Detailed 1.2 sa_sigaction function pointer 3rd parameter void * Explanation
1. sigaction function Detailed
The Sigaction function is more robust and more powerful than the signal
Signal System Function calls provide a simple example. However, the C prototype Declaration makes it look more complex than the actual one. The signal function associates a given function with a specific signal. Here is the definition in FreeBSD
Freud thought: To solve these problems, the parties will have to remember and understand their early childhood experience, to gain insight into the subconscious conflict. Freud's therapy, called "Psychoanalysis" (psychoanalysis), was widely adopted
Signal () function to describe Linux functions in detail
A signal (signal) is a interprocess communication mechanism that provides an application with an asynchronous software interrupt that gives the application the opportunity to accept
Header file# Include
Benefits:Set the corresponding action of a signal
Function prototype: Void (* signal (int signum, void (* handler) (int); or: typedef void (* sig_t) (int ); sig_t signal (int signum, sig_t handler );
Parameter description: The
Signal is a system call. is a special kind of interruption when a particular "software outage" occurs. The program used to invoke. Interrupts are typically special cases that occur during a program's operation, such as referencing an illegal address
In the ANSI standard, the signal () statement is as follows:
Void (* signal (INT Sig, void (* func) (INT)
Signal is a function that returns a function pointer. the function that the latter points to (the return value of signal) accepts an int
PrefaceIt is a very useful programming method to realize the soft interrupt of the program through the signal mechanism under Linux. When we press CTRL-C, ctrl-z or kill a process when the program is running, it is actually equivalent to sending a
First, describe the function pointer definition form:
data type (* function pointer name) (parameter table);
Where the storage type is generally not written, in the default form. Auto type, static type and extern type can be selected. The data
To understand a CProgramIt is not enough to understand the symbols that constitute the program. Programmers must also understand how these symbols are combined into declarations, expressions, statements, and programs.
Let's take a look at the
Signal is a system call that is a special kind of interrupt that is used to invoke a program when a particular "software break" occurs. Interrupts are typically special cases that occur during program execution, such as referencing an illegal
When you write the socket program under Linux, if you try to send it to a disconnected socket, it throws a sigpipe signal to the bottom. The default approach to this signal is to exit the process, which is not what we expected most of the time. The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.